package com.tarena.csmall.seckill.mapper;

import cn.tedu.mall.pojo.seckill.model.SeckillStockLog;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

public interface SeckillStockLogMapper {
    @Insert("insert into seckill_stock_log (sku_id,order_sn,quantity,gmt_create,gmt_modified) " +
        "values (#{skuId},#{orderSn},#{quantity},#{gmtCreate},#{gmtModified})")
    void insert(SeckillStockLog log);
    @Select("select count(id) from seckill_stock_log where order_sn=#{sn}")
    int selectCountByOrderSn(String sn) ;
    @Select("select * from seckill_stock_log where order_sn=#{sn} and sku_id=#{skuId}")
    SeckillStockLog selectStockLog(@Param("sn")String sn, @Param("skuId") Long id);
    @Delete("delete from seckill_stock_log where id=#{id}")
    void deleteByPrimaryKey(Long id);
}
